package com.atguigu.cloud.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.util.retry.Retry;

/**
 * @author HanYiMing
 * @description
 * @date 2024/3/20
 * @lastEditDate 2024/3/20
 * @lastEditAuthor
 * @lastDescription
 */
@Configuration
public class FeignConfig {

    /**
     * feign重试配置
     * @return
     */
    @Bean
    public Retryer myRetry() {
        return Retryer.NEVER_RETRY;
        // 最大请求此时为3（1+2），初始间隔时间为100ms，重试最大间隔时间为1S
//        return new Retryer.Default(100, 1, 3);
    }

    /**
     * feign日志打印配置
     * @return
     */
    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

}
